#include <iostream>
#include "RandomNumber.h"
#include "PlayerClass.h"
#include "SpaceClass.h"


using namespace std;

PlayerClass::PlayerClass()
{
}

PlayerClass::PlayerClass(int identification, bool isHuman)
{
  ID = identification;
  money = 1500;
  location = 0;
  bankrupt = false;
  human = isHuman;
}

int PlayerClass::roll()
{
  int die1 = getUniform(1, 6);
  int die2 = getUniform(1, 6);
  return (die1 + die2);
}

//void PlayerClass::move(int dice, SpaceClass* board)
//{
//  location = (location + dice)%40;
//}
/*
HumanClass::HumanClass(int identification)
{
  ID = identification;
  money = 1500;
  location = 0;//GO
  bankrupt = false;
  
}*/

void PlayerClass::takeTurn(SpaceClass *board)
{
  cout << endl;
  cout << "Player " << ID << "'s turn. Please select from the following\n";
  cout << "1. Roll\n2. Trade\n3. Mortgage/Unmortgage\nYour Choice: ";
  int choice;
  int dice;
  cin >> choice;
  if (choice == 1)
  {
    dice = roll();
    location = (location + dice)%BOARDSIZE;
    if (location == go)
    {
      //landed on go
    }
    else if (location - dice < 0)
    {
      //then you passed go
    }
    

    cout << "Player " << ID << " rolled a " << dice << " and landed on ";
    cout << board[location].getName() << endl;
    //printBoard(ID, location);
    return;
  }
  else if (choice == 2)
  {
    cout << "Not programmed yet" << endl;
  }
  else if (choice == 3)
  {
    cout << "Not programmed yet" << endl;
  }
  else
  {
    cout << "Invalid choice, try again" << endl;
    takeTurn(board);
    return;
  }
  takeTurn(board);
  return;
}

/*
ComputerClass::ComputerClass(int identification)
{
  ID = identification;
  money = 1500;
  location = 0;//GO
  bankrupt = false;
}

int ComputerClass::turn()
{

}*/
